# coding: utf-8
from application import db


class User(db.Model):
    __tablename__ = 't_user'

    id = db.Column(db.BigInteger, primary_key=True, unique=True, comment='序号')
    nickname = db.Column(db.String(50), comment='用户名')
    mobile = db.Column(db.String(20), nullable=False, unique=True, comment='手机号码')
    email = db.Column(db.String(100), nullable=False, comment='邮箱')
    gender = db.Column(db.Integer, comment='性别')
    avatar = db.Column(db.String(100), nullable=False, comment='头像')
    birthday = db.Column(db.Date, nullable=False, comment='出生日期')
    people_id = db.Column(db.String(18), nullable=False, unique=True, comment='身份证号')
    address = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), comment='用户地址')
    login_pwd = db.Column(db.String(32), comment='登录密码')
    login_salt = db.Column(db.String(32), unique=True, comment='随机加密')
    status = db.Column(db.Integer, comment='状态')
    blocknum = db.Column(db.Integer, comment='块高')
    blockHash = db.Column(db.String(200), unique=True, comment='块哈希')
    transactionhash = db.Column(db.String(200), unique=True, comment='交易哈希')
    created_time = db.Column(db.DateTime, nullable=False, comment='创建时间')
    updated_time = db.Column(db.DateTime, nullable=False, comment='更新时间')

    def __repr__(self):
        return '<User %r>' % self.nickname